<%@page import="itsm.isperp.framework.core.context.ContextHolder"%>
<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<div class="header">
	<h2>
		&nbsp;&nbsp;ad域配置<span><font color="red">（* 为必填项）</font> </span>
	</h2>
</div>
<form action="app/appConfig/save" id="formAppConfig" method="post">
	<table class=" form-table">
		<tbody>
			<tr>
				<td class="td1">域地址：</td>
				<td class="td2"><input type="text" id="txtAdHost" name="adHost"
					class="required" value="${adHost}" maxlength="50" style="width:30%" /><font
					color="blue">（例如：192.168.0.0）</font></td>
			</tr>
			<tr>
				<td class="td1">域端口：</td>
				<td class="td2"><input type="text" id="txtAdPort" name="adPort"
					class="required" value="${adPort}" maxlength="50" style="width:30%" /><font
					color="blue">（默认为 389）</font></td>
			</tr>
			<tr>
				<td class="td1">域控制器：</td>
				<td class="td2"><input type="text" id="txtAdDC" name="adDC"
					class="required" value="${adDC}" maxlength="50" style="width:30%" /><font
					color="blue">（例如：ad.local）</font></td>
			</tr>
			<tr>
				<td class="td1">登录帐号：</td>
				<td class="td2"><input type="text" id="txtAdUsername"
					class="required" name="adUsername" value="${adUsername}"
					maxlength="50" style="width:30%" /><font color="blue">（例如：admin@ad.local）

				
				</td>
			</tr>
			<tr>
				<td class="td1">密码：</td>
				<td class="td2"><input type="password" id="txtAdPassword"
					class="required" name="adPassword" value="${adPassword}"
					maxlength="50" style="width:30%" />
				</td>
			</tr>

			<tr>
				<td class="td1">系统组织节点：</td>
				<td class="td2"><input type="text" id="txtAdSystemOU"
					name="adSystemOU" value="${adSystemOU}" maxlength="50"
					style="width:30%" /><span><font color="blue">（如果是所有，用*号表示）</font>
				</span></td>
			</tr>
			<tr>
				<td class="td1">用户信息节点：</td>
				<td class="td2"><input type="text" id="txtAdCustomerUserOU"
					name="adCustomerUserOU" value="${adCustomerUserOU}" maxlength="50"
					style="width:30%" /><font color="blue">（如果是所有，用*号表示）</font></td>
			</tr>
			<tr>
				<td class="td1">用户所属客户：</td>
				<td class="td2"><input type="text" id="txtAdCustomer"
					style="display: none" name="adCustomer" value="${adCustomer}" /> <isperp:listSelector
						id="customerSelector" url="customer/customer/list"
						displayValue="${cusCustomerName }" valueControlId="txtAdCustomer"
						displayValueCssClass="required" displayValueCssStyle="width:30%">
						<isperp:column name="id" title="id" hidden="true" width="10"></isperp:column>
						<isperp:column name="name" title="名称" width="150">
						</isperp:column>
						<isperp:column name="type" title="类型" width="80">
						</isperp:column>
						<isperp:column name="linkman" title="联系人" width="80">
						</isperp:column>
						<isperp:column name="linktel" title="联系电话" width="80">
						</isperp:column>

					</isperp:listSelector> <font color="blue">（例如：xxx集团）</font></td>
			</tr>
			<tr>
				<td class="td1">使用域密码登录：</td>
				<td class="td2"><c:choose>
						<c:when test="${'1' eq adPasswordCheck}">
							<input type="checkbox" id="txtAdPasswordCheck"
								name="adPasswordCheck" value="1" checked="checked" />
						</c:when>
						<c:otherwise>
							<input type="checkbox" id="txtAdPasswordCheck"
								name="adPasswordCheck" value="1" />
						</c:otherwise>
					</c:choose></td>
			</tr>

		</tbody>
	</table>



</form>
<table class=" form-table" style="border:none;">
	<tbody>
		<tr style="border:none;">

			<td class="td2" style="border:none;padding:10px 0 10px 150px;"><button
					type="button" id="btnSaveAppConfig" class="nui-mainbtn"
					onclick="btnSaveAppConfigOnclick();" value="保存">&nbsp;&nbsp;&nbsp;保存&nbsp;&nbsp;&nbsp;</button>
				<button type="button" id="btnSync" onclick="btnSyncOnclick();"
					value="保存">&nbsp;&nbsp;&nbsp;马上同步&nbsp;&nbsp;&nbsp;</button>
			</td>
		</tr>

	</tbody>
</table>

<script type="text/javascript">
	function btnSyncOnclick() {
		$.post("app/appConfig/syncFromLdap", function(data) {
			if (data.success) {
				isperp.alert("数据同步成功！");
			} else {
				isperp.alert(data.tata);
			}
		});

	}

	function btnSaveAppConfigOnclick() {
		isperp.submitForm({
			formId : "formAppConfig",
			success : function(data) {
				if (data.success) {
					isperp.alert("保存成功！");
				} else {
					isperp.alert(data.tata);
				}
			}
		});
	}
</script>










